<template>
  <a-card :bordered='false' class='card-area'>
    <!-- 查询区域 11111-->
    <div class='table-page-search-wrapper'>
      <a-form layout='inline' :label-col='labelCol' @keyup.enter.native='searchQuery'>
        <a-row :gutter='24'>
          <a-col :md='6' :sm='8'>
            <a-form-item label='报告编码'>
              <a-input placeholder='请输入报告编码' v-model='queryParam.reportCode'></a-input>
            </a-form-item>
          </a-col>
          <a-col :md='6' :sm='8'>
            <a-form-item label='客户名称'>
              <a-input placeholder='请输入客户名称' v-model='queryParam.patientName'></a-input>
            </a-form-item>
          </a-col>
          <a-col :md='6' :sm='8'>
            <a-form-item label='评估等级'>
              <j-dict-select-tag placeholder="请选择评估等级" dictCode="risk_level" v-model="queryParam.riskLevel" />
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="查询日期">
              <j-date placeholder="请选择开始日期" class="query-group-cust" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss"
                      v-model="queryParam.startTime"></j-date>
              <span class="query-group-split-cust"></span>
              <j-date placeholder="请选择结束日期" class="query-group-cust" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss"
                      v-model="queryParam.endTime"></j-date>
            </a-form-item>
          </a-col>

          <span style='float: left;overflow: hidden;' class='table-page-search-submitButtons'>
           <a-col :md='6' :sm='24'>
               <a-button type='primary' @click='searchQuery' icon='search'>查询</a-button>
               <a-button type='primary' @click='searchReset' icon='reload' style='margin-left: 8px'>重置</a-button>
           </a-col>
        </span>
        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class='table-operator'>
<!--      <a-button type='primary' icon='download' @click='handleExportXls'>添加回访</a-button>-->
    </div>

    <!-- table区域-begin -->
    <div>
<!--      <div class='ant-alert ant-alert-info' style='margin-bottom: 16px;'>-->
<!--        <i class='anticon anticon-info-circle ant-alert-icon'></i>-->
<!--        <span>已选择</span>-->
<!--        <a style='font-weight: 600'>-->
<!--          {{ selectedRowKeys.length }}-->
<!--        </a>-->
<!--        <span>项</span>-->
<!--        <a style='margin-left: 24px' @click='onClearSelected'>清空</a>-->
<!--      </div>-->

      <a-table
        ref='table'
        size='middle'
        bordered
        rowKey='id'
        :columns='columns'
        :dataSource='dataSource'
        :pagination='ipagination'
        :loading='loading'
        :scroll="{ x: 1400 }"
        @change='handleTableChange'>

        <span slot='action' slot-scope='text, record'>
            <a @click='handleEdit(record)'>详情</a>
            <a-divider type="vertical" />
            <a @click='handleGoodsDataView(record)'>服务方案</a>
            <a-divider type="vertical" />
            <a @click='handleDyDataView(record)'>监察数据</a>
<!--            <a-divider type="vertical" />-->
<!--            <a @click='handleLogView(record)'>回访记录</a>-->
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <h-his-estimate-result-modal ref='modalForm' @ok='modalFormOk'></h-his-estimate-result-modal>
    <h-patient-evaluation-log-modal ref='modalLog' @ok='modalFormOk'></h-patient-evaluation-log-modal>
    <h-patient-evaluation-dy-data-log-modal ref="modalDyData" @ok='modalFormOk'></h-patient-evaluation-dy-data-log-modal>
    <h-patient-evaluation-goods-modal ref="modalGoodsData" @ok='modalFormOk'></h-patient-evaluation-goods-modal>
  </a-card>
</template>
<script>
import '@assets/less/TableExpand.less'
import HHisEstimateResultModal from './modules/HHisEstimateResultModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { putAction, getAction, postAction } from '@api/manage'
import { frozenBatch } from '@api/api'
import HPatientEvaluationLogModal from './modules/HPatientEvaluationLogModal'
import HPatientEvaluationDyDataLogModal from './modules/HPatientEvaluationDyDataLogModal'
import HPatientEvaluationGoodsModal from './modules/HPatientEvaluationGoodsModal'

export default {
  name: 'h_patient_evaluation_recordList',
  mixins: [JeecgListMixin],
  components: {
    HHisEstimateResultModal,
    HPatientEvaluationLogModal,
    HPatientEvaluationDyDataLogModal,
    HPatientEvaluationGoodsModal
  },
  data() {
    return {
      description: '患者心血管测评管理页面',
      labelCol: { style: { width: '110px' } },
      // 表头
      columns: [
        {
          title: '客户信息',
          align: 'left',
          dataIndex: 'patientName',
          customRender: function(text, record, index) {
            let textStr ='报告编码：' + record.reportCode + '\n'
            textStr +='报告时间：' + record.createTime + '\n'
            textStr +='观察有效期：' + record.effectiveTime + '\n'
            textStr +='姓名：' + record.patientName + '\n'
            textStr +='性别：' + record.patientSex + '\n'
            textStr +='年龄：' + record.patientAge + '岁\n'
            const answer = textStr.split('\n')
            return answer.map((item) => {
              return <li>{item}</li>
            })
          },
        },
        {
          title: '评估等级',
          align: 'center',
          dataIndex: 'riskLevel',
          width: 120
        },
        {
          title: '体重指数',
          align: 'center',
          dataIndex: 'w',
          customRender: function(t, r, index) {
            return t.resultValue+"("+t.intervalBriefRemark+")"
          },
          width: 100
        },
        {
          title: '心脏健康指数',
          align: 'center',
          dataIndex: 'k',
          customRender: function(t, r, index) {
            return t.resultValue+"("+t.intervalBriefRemark+")"
          },
          width: 120
        },
        {
          title: '健康心脏年损失值',
          align: 'center',
          dataIndex: 'm',
          customRender: function(t, r, index) {
            return t.resultValue
          },
          width: 140
        },
        {
          title: '心脏年龄',
          align: 'center',
          dataIndex: 'h',
          customRender: function(t, r, index) {
            return t.resultValue+"("+t.intervalBriefRemark+")"
          },
          width: 120
        },
        {
          title: '血管硬化指数',
          align: 'center',
          dataIndex: 'l',
          customRender: function(t, r, index) {
            return t.resultValue+"("+t.intervalBriefRemark+")"
          },
          width: 120
        },
        {
          title: '危险因子数',
          align: 'center',
          dataIndex: 'd',
          customRender: function(t, r, index) {
            return t.resultValue+"("+t.intervalBriefRemark+")"
          },
          width: 120
        },
        {
          title: '体质类型',
          align: 'center',
          dataIndex: 'c',
          customRender: function(t, r, index) {
            return t.resultValue
          },
          width: 120
        },
        {
          title: '是否确认',
          align: 'center',
          dataIndex: 'izSure',
          width: 120,
          customRender: function(t, r, index) {
            return t=='0'?"未确认":"已确认"
          },
        },
        {
          title: '负责医生',
          align: 'center',
          dataIndex: 'doctorName',
          width: 120,
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          fixed: 'right',
          scopedSlots: { customRender: 'action' },
          width: 200
        }
      ],
      url: {
        list: '/ch/evaluation/result/list',
      }
    }
  },
  computed: {

  },
  methods: {
    handleLogView(record) {
      this.$refs.modalLog.view(record)
      this.$refs.modalLog.title = '回访记录'
      this.$refs.modalLog.disableSubmit = false
    },
    handleDyDataView(record) {
      this.$refs.modalDyData.view(record)
      this.$refs.modalDyData.title = '监察数据'
      this.$refs.modalDyData.disableSubmit = false
    },
    handleGoodsDataView(record) {
      this.$refs.modalGoodsData.view(record)
      this.$refs.modalGoodsData.title = '服务方案'
      this.$refs.modalGoodsData.disableSubmit = false
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>